//
//  NSObject+NSObjectExtend.h
//  etionMisc
//
//  Created by wu jingxing on 13-5-8.
//  Copyright (c) 2013年 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <objc/runtime.h>

#import <objc/message.h>

#import "XMSNumber.h"

typedef NS_ENUM(NSUInteger,ENSObjectPropertyType)
{
    ENSObjectPropertyTypeID = 0,
    ENSObjectPropertyTypeNSString = 1,
    ENSObjectPropertyTypeNSDate = 2,
    ENSObjectPropertyTypeNSNumber,
    ENSObjectPropertyTypeNSData,

    ENSObjectPropertyTypeNSNumberInt,
    ENSObjectPropertyTypeNSNumberLongLong,
    ENSObjectPropertyTypeNSNumberDouble,
    ENSObjectPropertyTypeNSNumberFloat,

    ENSObjectPropertyTypeNumberInt,
    ENSObjectPropertyTypeNumberLongLong,
    ENSObjectPropertyTypeNumberULongLong,
    ENSObjectPropertyTypeNumberFloat,
    ENSObjectPropertyTypeNumberDouble,

    ENSObjectPropertyTypeInt,
    ENSObjectPropertyTypeFloat,
    ENSObjectPropertyTypeDouble,
    
    ENSObjectPropertyTypeArray,
    ENSObjectPropertyTypeDictionary,
    
    ENSObjectPropertyTypeMutableArray,
    ENSObjectPropertyTypeMutableDictionary,
    
    ENSObjectPropertyTypeBOOL,
} ;

@interface NSObject (NSObjectProperty)

- (NSString *)getPropertyType:(NSString *)szProperty;

- (NSString *)getPropertyType:(NSString *)szProperty isKindOfNSObject:(BOOL*)isKindOf;

+ (NSString *)getPropertyType:(Class)cls property:(NSString *)szProperty;

+ (NSString *)getPropertyType:(Class)cls property:(NSString *)szProperty isKindOfNSObject:(BOOL*)isKindOf;

- (NSArray *)getPropertyNameList;

+ (NSArray *)getPropertyNameList:(Class)cls;

+ (BOOL)isNSStringType:(NSString *)szType;

+ (BOOL)isNSDateType:(NSString *)szType;

+ (BOOL)isNSDataType:(NSString *)szType;

+ (BOOL)isNSNumberType:(NSString *)szType;

+ (BOOL)isNSXDictionaryType:(NSString *)szType;

+ (BOOL)isNSDictionaryType:(NSString *)szType;

+ (BOOL)isNSMutableDictionaryType:(NSString *)szType;

+ (BOOL)isNSXArrayType:(NSString *)szType;

+ (BOOL)isNSArrayType:(NSString *)szType;

+ (BOOL)isNSMutableArrayType:(NSString *)szType;

+ (BOOL)isCGUIDype:(NSString *)szType;



+ (BOOL)isNSNumberIntType:(NSString *)szType number:(NSNumber *)number;

+ (BOOL)isNSNumberBOOLType:(NSNumber *)number;

+ (BOOL)isNSNumberIntType:(NSNumber *)number;

+ (BOOL)isNSNumberLongLongType:(NSNumber *)number;

+ (BOOL)isNSNumberFloatType:(NSNumber *)number;

+ (BOOL)isNSNumberDoubleType:(NSNumber *)number;



+ (BOOL)isNumberIntType:(NSString *)szType;

+ (BOOL)isNumberLongLongType:(NSString *)szType;

+ (BOOL)isNumberULongLongType:(NSString *)szType;

+ (BOOL)isNumberFloatType:(NSString *)szType;

+ (BOOL)isNumberDoubleType:(NSString *)szType;



+ (BOOL)isIntType:(NSString *)szType;

+ (BOOL)isFloatType:(NSString *)szType;

+ (BOOL)isDoubleType:(NSString *)szType;

+ (BOOL)isGUIDType:(NSString *)szType;



+ (BOOL)isIntPointType:(NSString *)szType;

+ (BOOL)isFloatPointType:(NSString *)szType;

+ (BOOL)isDoublePointType:(NSString *)szType;




+ (ENSObjectPropertyType)NSObjectPropertyType:(NSString *)szProperty;

+ (ENSObjectPropertyType)NSNumberType:(NSNumber *)number;


- (NSDictionary*)objectPropertyToDictionaryKeyValue;


- (NSString *)descriptionWithSpace:(NSString *)space;

@end

@interface NSObject (NSObjectSendMessage)

+ (void *)objcMsgSendSuper:(id)receiver class:(Class)cls selector:(SEL)op arguments:(id)firstArgument,... NS_REQUIRES_NIL_TERMINATION;

- (void *)objcMsgSendSuper:(Class)cls selector:(SEL)op arguments:(id)firstArgument,... NS_REQUIRES_NIL_TERMINATION;

@end

@interface NSObject (NSObjectAssociatedValue)

-(void)setAssociatedAssingValue:(id)value withKey:(const char*)key;

-(void)setAssociatedRetainNonatomicValue:(id)value withKey:(const char*)key;

-(void)setAssociatedValue:(id)value withKey:(const char*)key andPolicy:(objc_AssociationPolicy)policy;

-(id)associatedValueForKey:(const char*)key;

-(void)removeAssociatedValues;

@end

@interface NSObject (NSObjectNotification)

- (void)addMainThreadObserverWithDictionarySelector:(NSDictionary*)dicSelector;

- (void)addMainThreadObserverWithDictionarySelector:(NSDictionary*)dicSelector object:(id)object;

- (void)removeObserver;

@end
